package cn.core.tool.aviator;

import com.googlecode.aviator.runtime.function.AbstractFunction;
import com.googlecode.aviator.runtime.function.FunctionUtils;
import com.googlecode.aviator.runtime.type.AviatorObject;
import com.googlecode.aviator.runtime.type.AviatorString;

import java.util.Map;

/**
 * 表达式引擎 >>> 打印日志
 */
public class LogFunc extends AbstractFunction {

  @Override
  public AviatorObject call(Map<String, Object> env, AviatorObject arg1) {
    String param1 = FunctionUtils.getStringValue(arg1, env);
    System.out.println(param1);
    return new AviatorString(param1);
  }

  @Override
  public String getName() {
    return "log";
  }

}
